/**
 * @file argsParser.h
 * @author SDK_TEAM
 * @brief
 * @version 0.1
 * @date 2022-10-26
 *
 * Copyright:
 * © 2018 北京灵汐科技有限公司 版权所有。
 * 注意：以下内容均为北京灵汐科技有限公司原创，未经本公司允许，不得转载，否则将视为侵权；对于不遵守此声明或者其他违法使用以下内容者，本公司依法保留追究权。
 * © 2018 Lynxi Technologies Co., Ltd. All rights reserved.
 * NOTICE: All information contained here is, and remains the property of Lynxi.
 * This file can not be copied or distributed without the permission of Lynxi
 * Technologies Co., Ltd.
 *
 */
#pragma once

#include <lyn_api.h>
#include <stdlib.h>
#include <algorithm>
#include <chrono>
#include <iomanip>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>
#include "util.hpp"
#include "CLI/CLI11.hpp" // 引入 CLI11 头文件

namespace ArgsParse
{
    bool lenetArgsParser(int argc, char *argv[])
    {
        // 创建 CLI11 应用程序实例
        CLI::App app;

        // 定义参数
        argInputFilePath = "../data/lenet_classify_ipeapu_time/Number.mp4";
        argModelPath = "../model/lenet/Net_0";
        argPostPluginPath = "../common/plugin/postprocess/cross_compiled_lib/libLenetPlugin.so";
        argChannel = 1;
        int showType = 1;
        std::string device_id = "0";

        // 添加选项
        app.add_option("input_video", argInputFilePath, "input MP4 video file path")->default_val(argInputFilePath);
        app.add_option("-m,--modelPath", argModelPath, "lenet model path")->default_val(argModelPath);
        app.add_option("-p,--postPlugPath", argPostPluginPath, "lenet post process plugin path")->default_val(argPostPluginPath);
        app.add_option("-d,--device_id", device_id, "test device number which can be 0~N-1 (N is device count), eg.:0,1,2")->default_val(device_id);
        app.add_option("-c,--channelCount", argChannel, "process channel count")->default_val(argChannel);
        app.add_option("-s,--showType", showType, "0: show test file directly, 1: save test result to be a file")->default_val(showType);

        // 解析命令行参数
        CLI11_PARSE(app, argc, argv);

        // 这里可以添加其他逻辑，例如设置芯片和显示类型等
        if (!setChips(device_id.c_str(), ','))
        {
            return false;
        }

        setShowType(showType);
        return true;
    }

} // namespace ArgsParse
